<?php

namespace app\models;

use yii\web\IdentityInterface;

/**
 * This is the model class for table "admin".
 *
 * @property int $id
 * @property string $admin_name
 * @property string $admin_pwd
 * @property int $is_admin
 * @property int $update_time
 * @property int $create_time
 */
class Admin extends \yii\db\ActiveRecord implements IdentityInterface
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'admin';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['admin_name', 'admin_pwd', 'update_time', 'create_time'], 'required'],
            [['is_admin', 'update_time', 'create_time'], 'integer'],
            [['admin_name'], 'string', 'max' => 32],
            [['admin_pwd'], 'string', 'max' => 64],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'admin_name' => 'Admin Name',
            'admin_pwd' => 'Admin Pwd',
            'is_admin' => 'Is Admin',
            'update_time' => 'Update Time',
            'create_time' => 'Create Time',
        ];
    }

    public static function findIdentity($id)
    {
        return Admin::findOne($id);
    }

    public static function findIdentityByAccessToken($token, $type = null)
    {
        return true;
    }

    public function getId()
    {
        return $this->id;
    }

    public function getAuthKey()
    {
        return true;
    }

    public function validateAuthKey($authKey)
    {
        return true;
    }
}
